package file;

import java.io.File;

/**
 * @author Huangjin
 * @version 1.0
 * describe:删除文件或目录
 * @date 2023/3/6 16:03
 */
public class DeleteFileDemo {
    public static void main(String[] args) {
        //File file = new File("./test.txt");
        //File file = new File("./demo");
        File file = new File("./demo/a/b/c");
        if (file.exists()){
            //file.delete();//删除单层
            file.deleteOnExit();
            System.out.println("删除成功！");
        }else {
            System.out.println("该文件不存在！");
        }
    }
}
